package com.buer.train.business.service.impl;

import com.buer.train.business.dao.MechanismDao;
import com.buer.train.business.domain.MechanismDO;
import com.buer.train.business.service.MechanismService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;



@Service
public class MechanismServiceImpl implements MechanismService {
	@Autowired
	private MechanismDao mechanismDao;
	
	@Override
	public MechanismDO get(Integer id){
		return mechanismDao.get(id);
	}
	
	@Override
	public List<MechanismDO> list(Map<String, Object> map){
		return mechanismDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return mechanismDao.count(map);
	}
	
	@Override
	public int save(MechanismDO mechanism){
		return mechanismDao.save(mechanism);
	}
	
	@Override
	public int update(MechanismDO mechanism){
		return mechanismDao.update(mechanism);
	}
	
	@Override
	public int remove(Integer id){
		return mechanismDao.remove(id);
	}
	
	@Override
	public int batchRemove(Integer[] ids){
		return mechanismDao.batchRemove(ids);
	}

    @Override
    public PageInfo<MechanismDO> getMechanismList(Map<String, Object> map) {
        PageHelper.startPage(map); //开始起始页
        List<MechanismDO> list = mechanismDao.getMechanismList(map); // 获取数据
        PageInfo<MechanismDO> page = new PageInfo<>(list); // 实例化PageInfo
        return page;
    }

    @Override
    public MechanismDO getOne(Map<String, Object> map){
        return mechanismDao.getOne(map);
    }
	
}
